var constant = require('./lib/constants');
var login = require('./lib/login');
var session = require('./lib/session');
var request = require('./lib/request');
var api = require('./lib/api');
var util = require('./utils/util');
var config = require('./lib/config');
var fonts = require('./lib/font');
var crypto = require('./utils/crypto'); //注意路径是否正确

var exports = module.exports = {
  api: api,
  login: login.login,
  LoginError: login.LoginError,
  clearSession: session.clear,

  request: request.request,
  buildSessionHeader: request.buildSessionHeader,
  RequestError: request.RequestError,

  util: util,
  constant: constant,
  session: session,
  config: config,
  fonts: fonts,
  crypto: crypto,
};

// 导出错误类型码
Object.keys(constant).forEach(function (key) {
  if (key.indexOf('ERR_') === 0) {
    exports[key] = constant[key];
  }
});
